package com.ohimy.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 区域封装类
 * 
 * @author Tony Tang
 * @version 1.0
 */
@Entity
@MappedSuperclass
@Table(name = "ohimy_district")
public class District implements Serializable {

	private static final long serialVersionUID = 1L;

	private long id;

	private String name; // 类别名

	private String pic; // 类别图标(20x20)

	private List<InfoSubSort> infoSubSort;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column(name = "_name", length = 16)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "_pic", length = 32)
	public String getPic() {
		return pic;
	}

	public void setPic(String pic) {
		this.pic = pic;
	}

	@OneToMany(mappedBy = "infoSort", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
	public List<InfoSubSort> getInfoSubSort() {
		return infoSubSort;
	}

	public void setInfoSubSort(List<InfoSubSort> infoSubSort) {
		this.infoSubSort = infoSubSort;
	}

}
